import { WereWolfBeforeNightPhase } from "@/werewolf/phases/beforeNight";
import { WereWolfPhaseView } from "@/werewolf/phaseView";
import { TimeOfDay, world } from "@minecraft/server";
import { Dimensions } from "@sapi-game/constants";
import { ScriptRunner } from "@sapi-game/Runner/scriptRunner";

export class BeforeNightCampView extends WereWolfPhaseView<WereWolfBeforeNightPhase> {
    override async runPhaseView(r: ScriptRunner): Promise<void> {
        await r.wait(10);
        world.structureManager.place("lrs_center", Dimensions.Overworld, {
            x: -207,
            y: -49,
            z: -187,
        });
        await r.wait(30);
        world.structureManager.place("lrs_center0", Dimensions.Overworld, {
            x: -207,
            y: -49,
            z: -187,
        });
        world.setTimeOfDay(TimeOfDay.Night);
        await r.wait(40);
        this.players.title("§e天色渐暗", "§a§l请玩家返回各自小屋");
        await r.wait(200);
        world.setTimeOfDay(TimeOfDay.Midnight);
        this.state.next();
    }
}
